<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  // 每次运行都把arr打乱生成新数组 洗牌
  function shuffle (arr) {
    for (let i = arr.length - 1; i > 0; i --) {
      const randomIndex = Math.floor(Math.random() * (i + 1))
      swap(arr, i, randomIndex)
    }
    return arr
  }

  function swap (arr, a, b) {
    const temp = arr[a]
    arr[a] = arr[b]
    arr[b] = temp
  }

  const arr = [91, 152, 23, 64, 235, 235, 100, 432, 31, 550]
  const newArr = shuffle(arr)
  console.log(newArr)
</script>
</body>
</html>
